package com.cl.util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

public class ExcelUtils {
	public static void main(String[] args) throws Exception {
		 //创建输入流 
//        InputStream stream1 = new FileInputStream("E:/项目/宁波/轻应用/试点单位兼职信息整理/大港引航工会导入表（金蝶整理）.xls");
//        InputStream stream1 = new FileInputStream("E:/项目/宁波/轻应用/试点单位兼职信息整理/环球置业工会导入表（金蝶整理）.xls");
        InputStream stream1 = new FileInputStream("E:/项目/宁波/轻应用/试点单位兼职信息整理/信通公司工会导入表（金蝶整理）.xls");
//        InputStream stream1 = new FileInputStream("E:/项目/宁波/轻应用/试点单位兼职信息整理/集团总部工会导入表（金蝶整理兼职）.xls");
        //获取Excel文件对象  
        Workbook  rwb1 = Workbook.getWorkbook(stream1);  
        //获取文件的指定工作表 默认的第一个  
        Sheet sheet1 = rwb1.getSheet(0);   
        JSONArray userArr = new JSONArray();
        for (int i = 1; i < sheet1.getRows(); i++) {
        	JSONObject user = new JSONObject();
        	user.put("name", sheet1.getCell(1,i).getContents());
        	user.put("zzmm", sheet1.getCell(2,i).getContents());
        	user.put("idcard", sheet1.getCell(3,i).getContents());
        	user.put("user", sheet1.getCell(4,i).getContents());
//            user.put("department", sheet1.getCell(5,i).getContents());
//            user.put("todepartment", sheet1.getCell(5,i).getContents());
            
//            user.put("jobTitle", sheet1.getCell(8,i).getContents());
//            user.put("tojobTitle", sheet1.getCell(8,i).getContents());
//            user.put("weights", 0);
//            user.put("toweights", sheet1.getRows()-i);
            userArr.add(user);
		}
        
		
        
//        JSONArray result = OpenaccessUtils.personAddcasvir(userArr);
//		System.out.println(result.toJSONString());
	}
}
